package ModelLayer;
import java.util.ArrayList;

/**
 * Write a description of class DVD here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class DVD
{
    private int no;
    private String title, releasedate;
    private ArrayList<Copy> dvdcopy;
    private Copy copy;

    public DVD(int no, String title, String releasedate)
    {
        this.no = no;
        this.title = title;
        this.releasedate = releasedate;
        dvdcopy = new ArrayList<Copy>();
    }
    
    public DVD()
    {
        no = 0;
        title = "no title";
        releasedate = "no release date";
        dvdcopy = new ArrayList<Copy>();
    }

    public void createDvdCopy(String serialNumber, String purchaseDate, String purchasePrice)
    {
        copy = new Copy(serialNumber, purchaseDate, purchasePrice);
        addCopy(copy);
    }
    
    public void addCopy(Copy c)
    {
        dvdcopy.add(c);
    }
    
    public void printInfo()
    {
        int i = 0;
        for (Copy c : dvdcopy)
        {
            i+=1;
        }
        System.out.println("No : " + getNo() + "\n" + "Title : " + getTitle() + "\n" + "Release date : " + getReleasedate() + "\n" + "Number of Copies: " + i + "\n" );
    }
    
    public int getNo()
    {
        return no;
    }
    
    public String getTitle()
    {
        return title;
    }
    
    public String getReleasedate()
    {
        return releasedate;
    }

    public void setNo(int no)
    {
        this.no = no;
    }
    
    public void setTitle(String title)
    {
        this.title = title;
    }
    
    public void setReleasedate(String releasedate)
    {
        this.releasedate = releasedate;
    }

    public Copy getCopy(int i)
    {
        return dvdcopy.get(i);
    }
    
    public int getSize()
    {
        return dvdcopy.size();
    }
}
